#ifndef MANAGE_TABS_H
#define MANAGE_TABS_H

#include <vector>
#include <QMainWindow>
#include <QTabWidget>
#include "tab.h"
#include "tablayout.h"

using std::vector;

class ManageTabs : public QTabWidget
{
    Q_OBJECT

public:
    ManageTabs(QWidget* parent);
    ~ManageTabs();
    QMainWindow* mainWindow;

protected:
    Tab* getTab(int index);
    void changeTitle(const QString& title);
    void setToolBarVisibility(int index, bool visible);
    void connectSignals(Tab* tab);
    void decreaseTabsIndex(int fromIndex);
    TabLayout* tabLayout;
    int unique_idx;
    int last_idx;

public slots:
    void newTab();
    void firstTab();
    void moveTabLeft();
    void moveTabRight();
    void changeTabTitle(const QString& title);
    void changeTabTitle(int index, const QString& title);
    void setMainWindowTitle(int index, const QString& title);
    void changeUrl(int index, QUrl url);
    void setFocusInUrl();

protected slots:
    void changeLocation(int index);
    void changeTab(int index);
    void closeTab(int index);
    void closeTab();

signals:
    void titleChanged(int index, const QString& title);
};

#endif // MANAGE_TABS_H
